<template>
  <van-dropdown-menu>
    <van-dropdown-item v-model="value1" :options="option1" />
    <van-dropdown-item v-model="value2" :options="option2" />
  </van-dropdown-menu>
</template>

<script>
  import { defineComponent,computed, ref } from "vue";
  export default defineComponent({
    name: 'subjectDropdownMenu',
    props: {
      childNode: Object
    },
    setup(props,{ emit }) {
      const activeName = ref('1')
      const isOpen = ref(false);
      const isFolder = computed(() => {
        return props.childNode.children && props.childNode.children.length;
      });

      const toggleHandle = () => {
        if (isFolder.value){
          isOpen.value = !isOpen.value
        } else {
          isOpen.value = true;
          emit("make-folder", props.childNode);
        }
      };

      return {
        activeName,
        isFolder,
        isOpen,
        toggleHandle
      };
    },
  });
  </script>
</script>

<style>
</style>
